getOrElse

inline fun <E> NotEmptyCollection<E>.getOrElse(index: PositiveInt, defaultValue: (PositiveInt) -> E): E

Returns the element at the specified index in this collection, or returns the result of calling the defaultValue function if the index is out of bounds.


inline fun <E> NotEmptyCollection<E>.getOrElse(index: Int, defaultValue: (Int) -> E): E

Deprecated

The index should be a PositiveInt or a StrictlyPositiveInt.

Replace with

import kotools.types.number.PositiveInt
this.getOrElse(PositiveInt(index), defaultValue)

Returns the element at the specified index in this collection, or returns the result of calling the defaultValue function if the index is out of bounds.